package puzzle.projecteuler.p100;

import java.math.BigInteger;

public class Problem057 {

	/**
	 * p1 = 3, q1 = 2
	 * p(n+1) = pn + 2*qn
	 * q(n+1) = pn + qn
	 * @param args
	 */
	public static void main(String[] args) {
		
		int c = 0;
		BigInteger p = BigInteger.valueOf(3);
		BigInteger q = BigInteger.valueOf(2);
		BigInteger two = BigInteger.valueOf(2);
		for (int i = 0; i < 999; i ++) {
			BigInteger x = p;
			p = q.multiply(two).add(x);
			q = x.add(q);
			int a = p.toString().length()-q.toString().length();
			if (a > 0) c ++;
		}
		System.out.println(c);
	}

}
